package com.company.基础.Array.twoDimensional.exer;

/**
 * 杨辉三角
 */
public class Array2 {
    public static void main(String[] args) {
        int[][] arr=new int[10][];
        for (int i = 0; i <arr.length ; i++) {
            arr[i]=new int[i+1];
            arr[i][0]=1;
            arr[i][i]=1;
            if (i>1){
                for (int j = 1; j <arr[i].length-1 ; j++) {
                    arr[i][j]=arr[i-1][j]+arr[i-1][j-1];
                }
            }
        }

        for (int j = 0; j <arr.length ; j++) {
            for (int g = 0; g <arr[j].length ; g++) {
                System.out.print(arr[j][g]+" ");
            }
            System.out.println("\n");
        }
    }
}
